<template>
	<view class="page page-fill">
		<view class="header">
			<view v-if="userIsLogin">
			<image src="../../static/icons/180x180.png" class="face"></image>
			</view>
			<view v-else>
			<image src="../../static/logo.png" class="face"></image>
			</view>
			
			<view class="info-wapper" v-if="userIsLogin">
				<navigator url="../meInfo/meInfo">
				<view class="nickname">
					{{userInfo}}
				</view>
				
				<view class="nav-info">ID:{{userInfo}}</view>
				</navigator>
			</view>
			<view v-else>
				<navigator url="../registLogin/registLogin">
				<view class="nickname regist-login">
					注册登录
				</view>
				</navigator>
			</view>
			
			<view class="set-wapper" v-if="userIsLogin">
				<navigator url="../myInfo/myInfo">
					<image src="../../static/icon.png" class="settings"></image>
				</navigator>
			</view>
			
		</view>
	</view>
</template>

<script>

	export default {
		components: {
		},
		data() {
			return {
				userIsLogin: false,
				userInfo: {}
		}
	},
	methods:{
	},
	onShow() {
		var me = this;
		//用户状态的切换
		// var userInfo = uni.getStorageSync("globalUser");
		// if(userInfo != null && userInfo != "" && userInfo != undefined){
		// 	me.userIsLogin = true;
		// 	me.userInfo = userInfo;
		// }else{
		// 	me.userIsLogin = false;
		// 	me.userInfo = {};
		// }
		//使用挂载方法获取用户数据
		var userInfo = me.getGlobalUser("globalUser");
		if(userInfo != null){
			me.userIsLogin = true;
			me.userInfo = userInfo;
		}else{
			me.userIsLogin = false;
			me.userInfo = {};
		}
	}
	
}
</script>

<style>
@import url("me.css");
</style>